package com.digitalchina.lxnsy.viewholder;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.BankListVO;
import com.digitalchina.lxnsy.interfaces.ICallBackPos;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：郑皓
 * 创建时间：2018/10/10 9:10
 * 修改备注：
 * ================================================
 */

public class BankListHolder extends BaseViewHolder<BankListVO> {

    private TextView tvBank;
    private TextView tvNumber;
    private TextView tvBranch;
    private TextView tvName;
    private TextView tvDelete;
    private ICallBackPos iCallBackPos;


    public BankListHolder(ViewGroup parent, ICallBackPos iCallBackPos) {
        super(parent, R.layout.item_bank_list);
        tvBank = $(R.id.tv_bank);
        tvNumber = $(R.id.tv_number);
        tvBranch = $(R.id.tv_branch);
        tvName = $(R.id.tv_name);
        tvDelete = $(R.id.tv_delete);

        this.iCallBackPos = iCallBackPos;
    }

    @Override
    public void setData(BankListVO data) {
        super.setData(data);

        tvBank.setText(data.getBankName() + "");
        tvNumber.setText("（" + data.getCardNumber() + "）");
        tvBranch.setText(data.getBranchName() + "");
        tvName.setText("（开户名：" + data.getUserName() + "）");

        tvDelete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                iCallBackPos.clickOk(getAdapterPosition());
            }
        });
    }

}
